theme_opts <- theme(
text = element_text(family = "inconsolata"),
plot.title = element_text(color = "#111111", size = 14, face = "bold", family = "inconsolata"),
plot.subtitle = element_text(color = "#111111", size = 11, family = "inconsolata"),
plot.caption = element_text(color = "#111111", size = 8, family = "inconsolata"),
plot.background = element_blank(),
panel.grid = element_blank(),
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
panel.background = element_rect(fill="white", colour="black"),
panel.border = element_blank(),
axis.text = element_blank(),
axis.line = element_blank(),
axis.ticks = element_blank(),
axis.title = element_blank(),
legend.title = element_blank()
)
# to limit bounds of map view
xmin <- min(df$x)
xmax <- max(df$x)
ymin <- min(df$y)
ymax <- max(df$y)
# shape scale option for variable hostilit_D
hostility_type <- c(
"Naval Engagement" = 1,
"Pirate Assault" = 2,
"Other" = 3,
"Unknown" = 4,
"Kidnapping" = 5,
"Suspicious Approach" = 6,
"Robbery" = 7,
"Attempted Boarding" = 8,
"Mothership Activity" = 9,
"Hijacking" = 10
)
# shape scale option for variable victim_l_D
victim_vessel_type <- c(
"Vessel" = 1,
"Cargo Ship" = 2,
"Other" = 3,
"Merchant Vessel" = 4,
"Tanker" = 5,
"Sailing Vessel" = 6,
"Fishing Vessel" = 7,
"Tugboat" = 8,
"Unknown" = 9,
"NA" = 10,
"Passenger Ship" = 11,
"Barge" = 12,
"Offshore Vessel" = 13,
"Anchored Ship" = 14
)
vw <- ggplot(data = ne_coastline) +
geom_sf(fill="#f0f0f0", color="#888888", stroke=0.5) +
geom_rect(data = navarea_boundaries, mapping=aes(xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, color = count), fill=NA, alpha=0.5) +
geom_text(data = navarea_boundaries, aes(x=xmin+(xmax-xmin)/2, y=ymin+(ymax-ymin)/2, label=navarea), size=4, family = "inconsolata") +
geom_point( data = df, aes(x=x, y=y, shape = victim_l_D ), size=1.25, alpha = 0.7 ) +
scale_shape_manual( values = victim_vessel_type ) +
scale_colour_stepsn(colours = c("black", "orange", "red"), guide = "none") +
coord_sf(xlim = c(xmin, xmax), ylim = c(ymin, ymax)) +
labs(x=NULL,
y=NULL,
title = "Anti-Shipping Activity Messages",
subtitle="with navarea zones") +
theme_bw() +
theme_opts +
theme(legend.position = "top")
girafe(ggobj = vw, width_svg = 16, height_svg = 6.20,
options = list(opts_sizing(rescale = TRUE, width = 1.0)))